﻿using System;
using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

namespace Acme.BookStore.Migrations
{
    /// <inheritdoc />
    public partial class Added_Kehu_And_Other_Tables : Migration
    {
        /// <inheritdoc />
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.CreateTable(
                name: "GongyingTable",
                columns: table => new
                {
                    supplier_code = table.Column<string>(type: "text", nullable: false),
                    full_name = table.Column<string>(type: "character varying(100)", maxLength: 100, nullable: false),
                    address = table.Column<string>(type: "text", nullable: false),
                    phone = table.Column<string>(type: "character varying(20)", maxLength: 20, nullable: false),
                    remarks = table.Column<string>(type: "text", nullable: false),
                    enterprise_attribute = table.Column<string>(type: "character varying(50)", maxLength: 50, nullable: false),
                    main_contact = table.Column<string>(type: "character varying(50)", maxLength: 50, nullable: false),
                    mobile = table.Column<string>(type: "character varying(20)", maxLength: 20, nullable: false),
                    email_address = table.Column<string>(type: "character varying(100)", maxLength: 100, nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_GongyingTable", x => x.supplier_code);
                });

            migrationBuilder.CreateTable(
                name: "KehuTable",
                columns: table => new
                {
                    code = table.Column<string>(type: "text", nullable: false),
                    name = table.Column<string>(type: "character varying(100)", maxLength: 100, nullable: false),
                    address = table.Column<string>(type: "text", nullable: false),
                    contact_person = table.Column<string>(type: "character varying(50)", maxLength: 50, nullable: false),
                    phone = table.Column<string>(type: "character varying(20)", maxLength: 20, nullable: false),
                    mobile = table.Column<string>(type: "character varying(20)", maxLength: 20, nullable: false),
                    contact1 = table.Column<string>(type: "character varying(50)", maxLength: 50, nullable: false),
                    enterprise_attribute = table.Column<string>(type: "character varying(50)", maxLength: 50, nullable: false),
                    contract_number = table.Column<string>(type: "character varying(50)", maxLength: 50, nullable: false),
                    phone1 = table.Column<string>(type: "character varying(20)", maxLength: 20, nullable: false),
                    email_address = table.Column<string>(type: "character varying(100)", maxLength: 100, nullable: false),
                    remarks = table.Column<string>(type: "text", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_KehuTable", x => x.code);
                });

            migrationBuilder.CreateTable(
                name: "RFIDTable",
                columns: table => new
                {
                    business_number = table.Column<string>(type: "text", nullable: false),
                    rfid1 = table.Column<string>(type: "character varying(50)", maxLength: 50, nullable: false),
                    creation_date = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
                    creator_login_name = table.Column<string>(type: "character varying(50)", maxLength: 50, nullable: false),
                    type = table.Column<string>(type: "character varying(20)", maxLength: 20, nullable: false),
                    business_content = table.Column<string>(type: "text", nullable: false),
                    rfid2 = table.Column<string>(type: "character varying(50)", maxLength: 50, nullable: false),
                    rfid3 = table.Column<string>(type: "character varying(50)", maxLength: 50, nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_RFIDTable", x => x.business_number);
                });

            migrationBuilder.CreateTable(
                name: "ShopTable",
                columns: table => new
                {
                    product_code = table.Column<string>(type: "text", nullable: false),
                    product_name = table.Column<string>(type: "character varying(100)", maxLength: 100, nullable: false),
                    english_name = table.Column<string>(type: "character varying(100)", maxLength: 100, nullable: false),
                    japanese_name = table.Column<string>(type: "character varying(100)", maxLength: 100, nullable: false),
                    specification = table.Column<string>(type: "text", nullable: false),
                    owner_code = table.Column<string>(type: "character varying(50)", maxLength: 50, nullable: false),
                    customer_product_code = table.Column<string>(type: "character varying(50)", maxLength: 50, nullable: false),
                    product_attribute = table.Column<string>(type: "character varying(50)", maxLength: 50, nullable: false),
                    category = table.Column<string>(type: "character varying(50)", maxLength: 50, nullable: false),
                    product_type = table.Column<string>(type: "character varying(50)", maxLength: 50, nullable: false),
                    split_control = table.Column<string>(type: "character varying(20)", maxLength: 20, nullable: false),
                    tray_layer_count = table.Column<int>(type: "integer", nullable: true),
                    tray_height = table.Column<int>(type: "integer", nullable: true),
                    billing_type = table.Column<string>(type: "character varying(50)", maxLength: 50, nullable: false),
                    barcode = table.Column<string>(type: "character varying(50)", maxLength: 50, nullable: false),
                    shelf_life_days_unit = table.Column<string>(type: "character varying(20)", maxLength: 20, nullable: false),
                    split_unit = table.Column<string>(type: "character varying(20)", maxLength: 20, nullable: false),
                    volume = table.Column<decimal>(type: "numeric", nullable: true),
                    weight = table.Column<decimal>(type: "numeric", nullable: true),
                    split_quantity = table.Column<int>(type: "integer", nullable: true),
                    price = table.Column<decimal>(type: "numeric", nullable: true),
                    length = table.Column<decimal>(type: "numeric", nullable: true),
                    width = table.Column<decimal>(type: "numeric", nullable: true),
                    height = table.Column<decimal>(type: "numeric", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_ShopTable", x => x.product_code);
                });

            migrationBuilder.CreateTable(
                name: "ShopWhereTable",
                columns: table => new
                {
                    owner_code = table.Column<string>(type: "character varying(50)", maxLength: 50, nullable: false),
                    product_code = table.Column<string>(type: "character varying(50)", maxLength: 50, nullable: false),
                    product_sku = table.Column<string>(type: "character varying(50)", maxLength: 50, nullable: false),
                    product_name = table.Column<string>(type: "character varying(100)", maxLength: 100, nullable: false),
                    base_unit = table.Column<string>(type: "character varying(20)", maxLength: 20, nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_ShopWhereTable", x => new { x.owner_code, x.product_code, x.product_sku });
                });
        }

        /// <inheritdoc />
        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropTable(
                name: "GongyingTable");

            migrationBuilder.DropTable(
                name: "KehuTable");

            migrationBuilder.DropTable(
                name: "RFIDTable");

            migrationBuilder.DropTable(
                name: "ShopTable");

            migrationBuilder.DropTable(
                name: "ShopWhereTable");
        }
    }
}
